home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld: Complete Mac Interactive
/
Macworld Complete Mac Interactive CD)(1994).iso
/
The Best of BMUG
/
Utilities
/
Text and Speech
/
Alpha.5.76
/
xtcls
/
example1.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-06-28
|
820b
|
44 lines
#include "xtcl.h"
/*
* Simple XTCL. Merely concatenates its arguments, separated by spaces.
* To run, use the Tcl shell to cd to the 'xtcls' direcotry and type
* "xtclcmd -f :concat Concat one two three"
*/
void
main(argc, argv, xpb)
long argc;
char **argv;
XTCLParmBlk *xpb;
{
char *ptr, state;
long i, length, slen;
xpb->result = TCL_OK;
length = GetHandleSize(xpb->resultH);
for (i = 1, slen = 0; i < argc; i++)
{
slen += strlen(argv[i]) + 1;
}
slen++;
// make power of four for luck's sake
slen += (sizeof(int) - (slen % sizeof(int)));
SetHandleSize(xpb->resultH, (long)slen);
state = HGetState(xpb->resultH);
HLock(xpb->resultH);
for (ptr=*xpb->resultH, i=1; i < argc; i++) {
strcat(ptr, argv[i]);
strcat(ptr, " ");
ptr += strlen(ptr);
}
HSetState(xpb->resultH, state);
}